<?php
	defined('_JEXEC') or die('Restricted access');
	//require_once(CUTEENGINE_FIELDS_PATH."field_text".DIRECTORY_SEPARATOR."field_text.php");
    
	//
    // t_filed_component_creator
    //
	class t_filed_component_creator extends t_base_field
	{
        
        // property declaration
		// protected
      

        // property declaration
		// public
		// B
		public $btn_next = null;
		public $btn_previous = null;
		public $component_id = null;
		public $component_type = null;
		
		//  I
		public $id_tag = null;
		public $istances_tag = null;
		//  o
		public $order_tag = null;
		//  T
		public $tab_tag = null;
		public $tab_common_parameters_tag = null;
		public $tab_specific_parameters_tag = null;
		public $tab_more_parameters_tag = null;
		// G
		const getting_component_method_url_parameter = 1;
		const getting_component_method_last = 2;
		// L
		const language_position_per_can_not_be_empty = 1;
        const language_position_per_invalid_value = 2;
		const language_position_last = 3;
		

		// P
        const proper_properties_position_per_getting_component_method = 1;
        const proper_properties_position_last = 2;
        // method declaration
    	// protected

		// A
        protected function adds_check_value_method()
        {
            global $g_javascript_namespace;
         	$g_javascript_namespace->header_script_generator->add_method_to_a_class_with_content(
				get_class($this),"check_value","a_name","
    var local_name = a_name;
	if (a_name == undefined)
		local_name = this.name;                
    var local_value = this.html_tag(local_name).value.trim();            
    var local_msg_tag = this.html_tag(local_name+'_msg');
    var local_msg = '';
    var local_return = ((local_value != '') || (!this.can_not_be_empty));
    if (!local_return)
    {
		local_msg = this.can_not_be_empty_msg;
    }
	else 
	{
		if (local_value != '')
		{
			local_return = local_value.validate_email(local_value);
			if (! local_return)
			{
				local_msg = this.invalid_value_msg;
			}    
		}
    }    
    if (!local_return)
        local_msg_tag.innerHTML = local_msg;
    else
        local_msg_tag.innerHTML = '';    
    
	return local_return;
    "); 
	
    
        }
        // G
		protected function get_field_event_script($a_event_type,$a_argouments)
        {			
			$local_return = '';
			return $local_return;
		}
static function get_help_proper_property($a_index)
		{
			$local_return = 'NO HELP AVAILABLE';
			/*switch ($a_index) 
            {
                case self::proper_properties_position_:
					$local_return = '';
				break;                
			}*/
			return $local_return;
		}
        static function get_default_proper_property($a_index)
		{
			$local_return = '';
			/*switch ($a_index) 
            {
                case self::proper_properties_position_:
					$local_return = 'TRUE';
				break;                
			}*/
			return $local_return;
		}
		protected function get_proper_properties_position_last()      
		{
            return self::proper_properties_position_last;
        }
		
        // method declaration
    	// public
        public function __construct($a_parent_part,$a_common_properties_str, $a_proper_properties_str)
		{
            global $g_url_parameters_namespace;
			parent::__construct($a_parent_part,$a_common_properties_str, $a_proper_properties_str);
            
			if ($this->get_getting_component_method() == self::getting_component_method_url_parameter)
                $this->component_id = $g_url_parameters_namespace->get_parameter_by_position(0); 
				
			/*$local_fields = "|t_field_email|".$this->name."_email|-1|0|".$this->lang[self::language_position_per_user]."|";
			$local_fields .= "|t_field_text|".$this->name."_password|-1|0|".$this->lang[self::language_position_per_password]."|";
			$local_fields .= "|t_field_button|".$this->name."_login|-3|0|".$this->lang[self::language_position_per_login];
			$local_fields .= "|t_field_button|".$this->name."_disconnect|-3|0|".$this->lang[self::language_position_per_disconnect]."|";*/
		}

		// C
		
        public function create_tags_structure()
        {
            global $g_javascript_namespace;
            //echo __METHOD__."<BR>";
			
			// creation arguments values
            $local_getting_component_method = $this->get_getting_component_method();
	
            parent::create_tags_structure(
				// ARGUMENTS DECLARATIONS
                "a_getting_component_method",
                // ARGUMENTS VALUES
                "$local_getting_component_method");
			// proprierties

			$g_javascript_namespace->header_script_generator->add_property_to_a_class(
                get_class($this),'getting_component_method',"a_getting_component_method",false);   
            // STYLE
			// tags    
            
		            
            $local_current_tag = parent::add_tag(t_base_tag_type::btt_div,$this->name . "_tabs");
            $this->tab_tag = $local_current_tag;
			$this->add_style_sheet_property("#".$this->tab_tag->name."","display","block");
			$this->add_style_sheet_property("#".$this->tab_tag->name."","width","500px");
			$this->add_style_sheet_property("#".$this->tab_tag->name."","height","500px");
			$this->add_style_sheet_property("#".$this->tab_tag->name."","background-color","lavender");		
			//$local_current_tag->class_name = "#".$this->tab_tag->name;
			$this->main_tag = $local_current_tag;
			$this->main_tag->include_child_str = false;
            $this->default_start_tag = $this->main_tag;
            $this->default_result_tag = $this->main_tag;
			// TABS
			$this->add_style_sheet_property(".".$this->tab_tag->name."_tabs","display","block");
			$this->add_style_sheet_property(".".$this->tab_tag->name."_tabs","position: relative");
			$this->add_style_sheet_property(".".$this->tab_tag->name."_tabs","width","100%");
			$this->add_style_sheet_property(".".$this->tab_tag->name."_tabs","height","100%");
			$this->add_style_sheet_property(".".$this->tab_tag->name."_tabs","background-color","azure");
			
			$this->tab_common_parameters_tag = $this->main_tag->create_and_add_child_at_bottom(t_base_tag_type::btt_div,$this->name . "_common_tab");
			$this->tab_common_parameters_tag->class_name = $this->tab_tag->name."_tabs";

            $this->tab_specific_parameters_tag = $this->main_tag->create_and_add_child_at_bottom(t_base_tag_type::btt_div,$this->name . "_specific_tab");   
			$this->tab_specific_parameters_tag->class_name = $this->tab_tag->name."_tabs";
			
			$this->tab_more_parameters_tag = $this->main_tag->create_and_add_child_at_bottom(t_base_tag_type::btt_div,$this->name . "_more_tab");  
            $this->tab_more_parameters_tag->class_name = $this->tab_tag->name."_tabs"; 
			
			//BUTTONS
			$this->add_style_sheet_property(".".$this->tab_tag->name."_buttons","display","block");
			
			$this->btn_next = $this->main_tag->create_and_add_child_at_bottom(t_base_tag_type::btt_button,$this->name . "_btn_next");
			$this->btn_next->class_name = $this->tab_tag->name."_buttons";

            $this->btn_previous = $this->main_tag->create_and_add_child_at_bottom(t_base_tag_type::btt_button,$this->name . "btn_previous");   
			$this->btn_previous->class_name = $this->tab_tag->name."_buttons";

			// method
           // $this->adds_check_value_method(); ?????
    
        }
        // G
		public function get_getting_component_method()
		{
            return $this->proper_properties_array[self::proper_properties_position_per_getting_component_method];
        }		
		public function get_included_in_html_structure($a_name,$a_display,$a_key_tag_name)
		{
			/*//parent::get_included_in_html_structure($a_name);
			if ($a_display)
			{
				if (isset($this->label_tag))
					$this->label_tag->add_style_property('display','');
				$this->email_tag->add_style_property('display','');
				$this->message_tag->add_style_property('display','');
			}
			else
			{
				if (isset($this->label_tag))
					$this->label_tag->add_style_property('display','none');			
				$this->email_tag->add_style_property('display','none');
				$this->message_tag->add_style_property('display','none');
			}	
			$this->key_tags_list[$a_name] = $a_key_tag_name;
			//echo "a_name: $a_name - a_key_tag_name: $a_key_tag_name<br>";
			$local_label_script = '';
			if (isset($this->label_tag))
				$local_label_script = $this->label_tag->generate_html_code_with_new_name($a_name.t_field_text::postfix_label_tag_name);
			return $local_label_script .
				($this->email_tag->generate_html_code_with_new_name($a_name) .
				$this->message_tag->generate_html_code_with_new_name($a_name.t_field_text::postfix_message_tag_name));*/
		}
		public function create_javascript_initialization_component()
		{
		}		
		public function get_language_position_last()
        {
            return self::language_position_last;
        }
		public function get_result_action_script($a_event_type,$parent_event_type,
            $a_parameter,$a_content_loader_result)
		{
            return '';
        }		
		
// I
		public function initialize_field_event($a_event_type)
        {			
			
		}
        
       

		

    }
?>    